import request from '@/utils/request'

/**
 * 获取员工简单列表
 * @returns
 */
export const getEmployeesSimpleListAPI = () => {
  return request({
    url: '/sys/user/simple',
    method: 'GET'
  })
}

/**
 * 获取员工列表
 * @returns
 */
export const getEmployeesListAPI = (params) => {
  return request({
    url: '/sys/user',
    method: 'GET',
    params
  })
}

/**
 * 新增员工
 * @param {*} data
 * @returns promise
 */
export const AddEmployeesAPI = (data) => {
  return request({
    url: '/sys/user',
    method: 'POST',
    data
  })
}

/**
 * 删除员工
 * @param {*} id
 * @returns
 */
export const DelEmployeesAPI = (id) => {
  return request({
    url: '/sys/user/' + id,
    method: 'DELETE'
  })
}

/**
 * 批量导入员工
 * @param {*} data
 * @returns
 */
export const ImportEmployeesAPI = (data) => {
  return request({
    url: '/sys/user/batch',
    method: 'POST',
    data
  })
}
// 获取员工岗位信息  /employees/{id}/jobs

export const GetEmployeesJobInfoAPI = (id) => {
  return request({
    url: '/employees/' + id + '/jobs',
    method: 'GET'
  })
}

// 保存员工岗位信息  /employees/{id}/jobs

export const SaveEmployeesJobInfoAPI = (data) => {
  return request({
    url: '/employees/' + data.userId + '/jobs',
    method: 'PUT',
    data
  })
}

/**
 * 获取员工个人信息
 * @param {*} id
 * @returns
 */
export const GetEmployeespersonalInfoAPI = (id) => {
  return request({
    url: '/employees/' + id + '/personalInfo',
    method: 'GET'
  })
}

/**
 * 保存员工基本信息
 * @param {*} id
 * @returns
 */
export const SaveEmployeeBaseInfoAPI = (data) => {
  return request({
    url: '/sys/user/' + data.id,
    method: 'PUT',
    data
  })
}

/**
 * 保存员工个人信息
 * @param {*} data
 * @returns
 */
export const SaveEmployeespersonalInfoAPI = (data) => {
  return request({
    url: '/employees/' + data.id + '/personalInfo',
    method: 'PUT',
    data
  })
}

/**
 * 给员工分配角色
 * @param {*} data
 * @returns
 */
export const dispatchRoleToEmployeesAPI = (data) => {
  return request({
    url: '/sys/user/assignRoles',
    method: 'PUT',
    data
  })
}

